package timing.ukulele.share;

import java.util.Arrays;

public enum UserLabelEnum {
    SUPER("super", "超级管理员"),
    ADMIN("admin", "管理员"),
    OPERATOR("operator", "运营人员"),
    USER("user", "用户");

    UserLabelEnum(String label, String description) {
        this.label = label;
        this.description = description;
    }

    private String label;
    private String description;


    public static Boolean hasLabel(String label) {
        long count = Arrays.stream(values()).filter(item -> item.label.equals(label)).count();
        return count > 0;
    }

    public static String getDescriptionByLabel(String label) {
        if (label == null)
            return "未知";
        for (UserLabelEnum method : values()) {
            if (method.label.equals(label)) {
                return method.label;
            }
        }
        return "未知";
    }


    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}
